home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 11 / CU Amiga Magazine's Super CD-ROM 11 (1997)(EMAP Images)(GB)(Track 1 of 3)[!][issue 1997-06].iso / s / groupattr.pprx < prev    next >
Text File  |  1992-03-14  |  5KB  |  240 lines

  1. /*
  2. @BGroupAttr  @P@ICopyright Gold Disk Inc. February, 1992
  3.  
  4. This Genie will change the attributes of all boxes in a group.
  5.  
  6. */
  7. signal on error
  8. signal on syntax
  9.  
  10. pageopts = "OODDEEVENAALL"
  11. cr = '0a'x
  12. counter = 0
  13.  
  14. address command
  15. call SafeEndEdit.rexx()
  16. box = ppm_GroupFirstBox()
  17. if box = 0 then exit_msg("Select a group first!")
  18.  
  19. call ppm_AutoUpdate(0)
  20.  
  21. commands.1      = "Position"
  22. commands.1.1    = "left:"cr"top:"
  23. commands.1.2    = "verifynumbers"
  24. commands.2      = "Angle"
  25. commands.2.1    = "Angle:"
  26. commands.2.2    = "verifynumbers"
  27. commands.3      = "Margins"
  28. commands.3.1    = "left:"cr"top:"cr"right:"cr"bottom:"
  29. commands.3.2    = "verifynumbers"
  30. commands.4      = "Standoff"
  31. commands.4.1    = "Standoff:"
  32. commands.4.2    = "verifynumbers"
  33. commands.5      = "Size"
  34. commands.5.1    = "width:"cr"height:"
  35. commands.5.2    = "verifynumbers"
  36. commands.6      = "Offset"
  37. commands.6.1    = "X offset:"cr"Y offset:"
  38. commands.6.2    = "verifynumbers"
  39. commands.7      = "Lock"
  40. commands.7.1    = "Enter Yes or No"
  41. commands.7.2    = "yntonumbers"
  42. commands.8      = "TextWrap"
  43. commands.8.1    = "Enter Type:"cr"Side:"
  44. commands.8.2    = "verifynumbers"
  45. commands.9      = "Hide"
  46. commands.9.1    = "Enter Yes or No"
  47. commands.9.2    = "yntonumbers"
  48. commands.10     = "Frame"
  49. commands.10.1   = "Enter Yes or No"
  50. commands.10.2   = "yntonumbers"
  51. commands.11     = "Transparent"
  52. commands.11.1   = "Enter Yes or No"
  53. commands.11.2   = "yntonumbers"
  54. commands.12     = "FrameData"
  55. commands.12.1   = "Line Color:"cr"Fill Color:"cr"Line Weight:"cr"Line Pattern:"cr"Fill Pattern:"
  56. commands.12.2   = ""
  57. commands.13     = "Tabs"
  58. commands.13.1   = "Tabs:"
  59. commands.13.2   = "verifytabs"
  60. commands.14     = "Scale"
  61. commands.14.1   = "X Scale:"cr"Y Scale:"
  62. commands.14.2   = "verifynumbers"
  63.  
  64. command = ''
  65.  
  66. do i = 1 to 14
  67.  
  68.     command = command||commands.i||cr
  69.  
  70. end
  71.  
  72. command = left(command, length(command) - 1)
  73.  
  74. commands = ppm_SelectFromList("Select command to apply to boxes..",30,5,1,command)
  75. if commands = '' then exit_msg()
  76.  
  77. com = 0
  78.  
  79. do while commands ~= ''
  80.  
  81.     com = com + 1
  82.     parse var commands command.com '0a'x commands
  83.  
  84.     do i = 1 to 14
  85.         if command.com = commands.i then leave
  86.     end
  87.  
  88.     if pos(':', commands.i.1) ~= 0 then
  89.     do
  90.        interpret "settings = ppm_GetBox"command.com"(box)"
  91.        commands.i.1 = stuffsettings(settings, commands.i.1)
  92.     end
  93.  
  94.     args.com = ppm_GetForm("Enter Values for "command.com, min(length(commands.i.1), 40), commands.i.1)
  95.     if args.com = '' then exit_msg()
  96.  
  97.     if command.com = "Tabs" then 
  98.        args.com = verifytabs(args.com)
  99.     else
  100.        args.com = separate(args.com, commands.i.2)
  101.  
  102. end
  103.  
  104.  
  105. do while box ~= 0
  106.  
  107.     do c = 1 to com
  108.         interpret "call ppm_SetBox"command.c"(box,"args.c")"
  109.     end
  110.     box = ppm_GroupNextBox(box)
  111.  
  112. end
  113.  
  114. call exit_msg()
  115.  
  116. error:
  117. syntax:
  118. do
  119.     exit_msg("Genie failed due to error: "errortext(rc)||'0a'x||"Line "SIGL)
  120. end
  121.  
  122. exit_msg:
  123. do
  124.     parse arg message
  125.  
  126.     if message ~= '' then
  127.         call ppm_Inform(1, message,)
  128.  
  129.    call ppm_ClearStatus()
  130.     call ppm_AutoUpdate(1)
  131.     exit
  132. end
  133.  
  134. separate:
  135. do
  136.     parse arg string, vfunction
  137.  
  138.     output  = ''
  139.  
  140.     do forever
  141.  
  142.         parse var string item '0a'x string
  143.  
  144.       if vfunction ~= '' then
  145.            interpret "item = "vfunction"("item")"
  146.  
  147.         item = "'"item"'"
  148.  
  149.         if string = '' then 
  150.             return(output||item)
  151.         else
  152.             output = output||item","
  153.     end
  154. end
  155.  
  156. verifynumbers: procedure
  157. do
  158.     parse arg number
  159.  
  160.     if ~datatype(number, n) then exit_msg("Invalid input")
  161.     return(number)
  162.  
  163. end
  164.  
  165.  
  166. yntonumbers: procedure 
  167. do
  168.     parse arg type
  169.  
  170.     type = upper(type)
  171.  
  172.     if left(type, 1) = "Y" then return(1)
  173.     if left(type, 1) = "N" then return(0)
  174.     call exit_msg("Invalid Entry")
  175. end
  176.  
  177. verifytabs: procedure 
  178. do
  179.    parse arg tabs
  180.  
  181.    output = ''
  182.  
  183.    tabs = strip(tabs)
  184.  
  185.    do 16
  186.  
  187.       parse var tabs tab ' ' tabs
  188.  
  189.       if tab = '' then tab = 0
  190.       if ~datatype(tab, n) then exit_msg("Invalid Entry")
  191.  
  192.       output = output" "tab
  193.  
  194.       tabs = strip(tabs)
  195.  
  196.    end
  197.  
  198.    return('"'output'"')
  199. end
  200.  
  201. stuffsettings: procedure
  202. do
  203.    parse arg settings, prompt
  204.  
  205.    output = ''
  206.    counter = 1
  207.    colon = pos(':', prompt)
  208.    cr = pos('0a'x, settings)
  209.  
  210.    if cr ~= 0 then
  211.    do
  212.        do while colon ~= 0
  213.              
  214.           parse var settings default '0a'x settings
  215.  
  216.           prompt = insert(default, prompt, colon)
  217.           colon = pos(':', prompt, colon + 1)
  218.  
  219.        end
  220.  
  221.        return(prompt)
  222.  
  223.   end
  224.  
  225.  
  226.  
  227.    do while colon ~= 0
  228.  
  229.       prompt = insert(word(settings, counter), prompt, colon)
  230.       counter = counter + 1
  231.  
  232.       colon = pos(':', prompt, colon + 1)
  233.    end
  234.  
  235.    prompt = prompt" " || subword(settings, counter)
  236.  
  237.    return(prompt)
  238.  
  239. end
  240.